package org.example;

import org.Annotation.TestAnnotation;
import org.Assert.TestAssert;
import org.Big.TestBigInteger;
import org.Big.TestDecimal;
import org.Boxing.TestBoxing;
import org.Date.TestCalendar;
import org.Date.TestDate;
import org.Exception.TestException;
import org.Hex.TestHex;
import org.Record.TestRecord;
import org.Reflection.DyncProxy;
import org.Reflection.GetClass;
import org.Sort.testArraySort;
import org.String.TestString;
import org.Tools.TestTools;
import org.Utils.IOUtils;
import org.Utils.UnsignedIntOutPut;
import org.apache.logging.log4j.LogManager;
import org.arguments.TestArguments;
import org.generics.TestGenerics;

import java.util.Date;
import java.util.logging.Logger;

//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;


public class Main {
    private static final Logger logger = Logger.getLogger(Main.class.getName());
//    private static final Log log = LogFactory.getLog(Main.class.getName());
    private static final org.apache.logging.log4j.Logger log4j = LogManager.getLogger(Main.class);

    public static void main(String[] args) {
//        logger.info("Start process...");
//        log.info("log Start process...");
        log4j.info("log4j Start process...");
        try {
            TestDate.printZeroDate();
            IOUtils.printEquals();
            TestDate.dateFormat();
            IOUtils.printEquals();
            TestDate.formatString2Date();
            IOUtils.printEquals();
            TestDate.sortDateByTime();
            IOUtils.printEquals();
            TestDate.currentMS();
            IOUtils.printEquals();
            TestDate.random1995Date();
            IOUtils.printEquals();
            TestCalendar.setTime();
            IOUtils.printEquals();
            TestCalendar.turnCalendar();
            IOUtils.printEquals();
            TestCalendar.find3rdLastDayOfNextMonth(new Date());
            IOUtils.printEquals();
            testArraySort.testDescendingOrder();
            IOUtils.printEquals();
            testArraySort.testDeepToString();
            IOUtils.printEquals();
            testArraySort.testArrayAverage();
            IOUtils.printEquals();
            TestArguments.list(args);
            IOUtils.printEquals();
            TestArguments.printVersion(args);
            IOUtils.printEquals();
            TestString.testFormat();
            IOUtils.printEquals();
            TestString.testEncoding();
            IOUtils.printEquals();
            TestString.testInsertSql();
            IOUtils.printEquals();
            TestString.testStringJoin();
            IOUtils.printEquals();
            TestString.testStringJoiner();
            IOUtils.printEquals();
            TestString.testSelectSql();
            IOUtils.printEquals();
            TestBoxing.testBoxEquals();
            IOUtils.printEquals();
//            TestRecord.test();
            IOUtils.printEquals();
            TestBigInteger.test();
            IOUtils.printEquals();
            TestDecimal.test();
            IOUtils.printEquals();
            TestHex.test();
            IOUtils.printEquals();
            TestTools.testRandom();
            IOUtils.printEquals();

            System.out.println("out put 1 = " + UnsignedIntOutPut.output1(-1));
            System.out.printf("-1 %X \n", -1);
            System.out.printf("-2 %X \n", -2);
            long num = (long) (Math.pow(2, 32) - 1);
            System.out.println("num " + num);
            System.out.println("out put 2 = " + UnsignedIntOutPut.output2(-2));
            IOUtils.printEquals();
            TestTools.testSecureRandom();
            IOUtils.printEquals();
//        TestException.testFinally();
//        IOUtils.printEquals();
//        TestException.testFinallyException();
//        IOUtils.printEquals();
            TestException.testNullPointerException();
            IOUtils.printEquals();
            TestAssert.testAssertOption();
            IOUtils.printEquals();
        } catch (Exception e) {
//            logger.severe(e.getMessage());
//            log.error(e.getMessage());
            log4j.error(e.getMessage());
        } finally {
//            logger.info("Process end.");
//            log.info("log Process end.");
            log4j.info("log4j Process end.");
            IOUtils.printEquals();
        }

        GetClass.printCommonClass();
        IOUtils.printEquals();
        GetClass.getField();
        IOUtils.printEquals();
        GetClass.getFieldValue();
        IOUtils.printEquals();
        GetClass.getMethod();
        IOUtils.printEquals();
        GetClass.getConstructor();
        IOUtils.printEquals();
        GetClass.getSuper();
        IOUtils.printEquals();
        DyncProxy.execute();
        IOUtils.printEquals();
        TestAnnotation.test();
        IOUtils.printEquals();
        TestGenerics.test();
        IOUtils.printEquals();
    }
}